/*
* Copyright (c) 2008 Matt Giger http://earthbrowser.com/
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
* ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
* SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/

/**
* FeatureView
*
* Control the camera zoom with a graphical slider with buttons
* 
*/
function FeatureWind(plugin, properties)
{
	var self = this;
	
	// Get into the plugin namespace
	with(plugin)
	{
		// Create a draggable input frame
		self.base =	new Frame({
			x:10, y:15, width:220, height:140, draggable:true,
			frameRadius:20, frameWidth:1, backColor:0xffffff, backAlpha:0.6
		});
		self.base.setFilters([new DropShadowFilter(3, 45, 1 ,0.75)]);
		
		self.base.addPane(new Label({x:10, y:2, bold:true, color:0, text:(properties && properties.title) ? properties.title : "Feature Window"}));

		// window resizer
		var resizer = self.base.addPane(
			new Resizer({
				x:self.base.getWidth()-14, y:self.base.getHeight()-14, binding:BIND_BOTTOM|BIND_RIGHT,
				minWidth:200, minHeight:46, maxWidth:400, maxHeight:getHeight()-40
			})
		);
		resizer.setTarget(self.base);
		
		// Feature pane
		self.featureView = self.base.addPane(
			new Scroller({
				x:8, y:22, visible:true,
				width:self.base.getWidth()-16, height:self.base.getHeight()-36,
				frameWidth:1, vscroll:true, binding:BIND_ALL
			})
		);
		
		// close button
		self.close = self.base.addPane(
			new Icon({
				skin:'close', x:self.base.getWidth()-18, y:6, binding:BIND_TOP|BIND_RIGHT
			})
		);
		
		// function to set the feature
		self.setFeature = function(ftr)
		{
			self.featureView.removeAllPanes();
			self.featureView.addPane(ftr.getListView()).setProperties({x:2, y:2});
		};
	}
	
	return self;
}
